package com.bst.bsj.common.dal.ibatis;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.bst.bsj.common.dal.daointerface.MerchantRoleDAO;
import com.bst.bsj.common.dal.dataobject.MerchantRole;
import com.sylinxsoft.tools.dao.impl.CommonBaseDAOImpl;

@Service("merchantRoleDAO")
public class MerchantRoleDAOImpl extends CommonBaseDAOImpl implements MerchantRoleDAO {


  @Override
  public Long save(MerchantRole merchantRole) {
    return (Long) this.getSqlMapClientTemplate().insert(getNameSpace() + ".MS_INSERT", merchantRole); 
  }


  @Override
  public int delete(Long merchantId) {
    return getSqlMapClientTemplate().delete(getNameSpace() + ".MS_DELETE_BY_USERID", merchantId);
  }


  @Override
  public MerchantRole getUserId(Long merchantId) {
    
    return (MerchantRole) this.getSqlMapClientTemplate().queryForObject(getNameSpace()+".MS_SELECT", merchantId);
 }


  @Override
  public void update(Long merchantId, Long roleId) {
    Map<String,Long> map = new HashMap<String,Long>();
    map.put("merchantId", merchantId);
    map.put("roleId", roleId);
    this.getSqlMapClientTemplate().update(getNameSpace() + ".MS_UPDATE",map);
  }

  
}
